/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.util.ObjectUtil
 *  cn.hutool.core.util.StrUtil
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.Button
 *  javafx.scene.control.TextField
 *  javafx.scene.layout.Pane
 *  javafx.stage.Stage
 *  org.springframework.beans.factory.annotation.Autowired
 */
package com.gys.controller.temphumi;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.gys.common.business.TempHumiUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.util.CacheUtil;
import com.gys.controller.BaseController;
import com.gys.controller.temphumi.TempHumiController;
import com.gys.data.example.GetLoginStoreOutData;
import com.gys.data.temphumi.TempHumiInData;
import de.felixroske.jfxsupport.FXMLController;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import org.springframework.beans.factory.annotation.Autowired;

@FXMLController
public class AddTempHumiController
extends BaseController
implements Initializable {
    @FXML
    private Button addBtn;
    @FXML
    private Button cancelBth;
    @FXML
    private Pane modelPane;
    @FXML
    private TextField gsthBrId;
    @FXML
    private TextField gsthBrName;
    @FXML
    private TextField gsthTemp;
    @FXML
    private TextField gsthHumi;
    @FXML
    private TextField gsthCheckTemp;
    @FXML
    private TextField gsthCheckHumi;
    @FXML
    private TextField gsthCheckStep;
    @FXML
    private TextField gsthArea;
    @FXML
    private Stage stg;
    @Autowired
    private TempHumiController tempHumiController;

    public void initialize(URL location, ResourceBundle resources) {
        this.initPane();
        this.gsthBrId.setText(((GetLoginStoreOutData)CacheUtil.get("store")).getStoCode());
        this.gsthBrId.setEditable(false);
        this.gsthBrName.setText(((GetLoginStoreOutData)CacheUtil.get("store")).getStoName());
        this.gsthBrName.setEditable(false);
    }

    private void initPane() {
        this.gsthTemp.clear();
        this.gsthHumi.clear();
        this.gsthCheckTemp.clear();
        this.gsthCheckHumi.clear();
        this.gsthCheckStep.clear();
        this.gsthArea.clear();
    }

    @Override
    public void init() {
        if (ObjectUtil.isNotEmpty(this.addBtn)) {
            this.initPane();
        }
    }

    @FXML
    private void addTempHumi() {
        String temp = this.gsthTemp.getText().trim();
        String humi = this.gsthHumi.getText().trim();
        String checkStep = this.gsthCheckStep.getText().trim();
        String checkTemp = this.gsthCheckTemp.getText().trim();
        String checkHumi = this.gsthCheckHumi.getText().trim();
        String area = this.gsthArea.getText().trim();
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)temp)) {
            alert.setContentText("\u5e93\u5185\u6e29\u5ea6\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (temp.length() > 10) {
            alert.setContentText("\u5e93\u5185\u6e29\u5ea6\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)humi)) {
            alert.setContentText("\u5e93\u5185\u6e7f\u5ea6\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (humi.length() > 10) {
            alert.setContentText("\u5e93\u5185\u6e7f\u5ea6\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)checkTemp)) {
            alert.setContentText("\u8c03\u63a7\u540e\u6e29\u5ea6\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (checkTemp.length() > 10) {
            alert.setContentText("\u8c03\u63a7\u540e\u6e29\u5ea6\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)checkHumi)) {
            alert.setContentText("\u8c03\u63a7\u540e\u6e7f\u5ea6\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (checkHumi.length() > 10) {
            alert.setContentText("\u8c03\u63a7\u540e\u6e7f\u5ea6\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)checkStep)) {
            alert.setContentText("\u8c03\u63a7\u63aa\u65bd\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (checkStep.length() > 10) {
            alert.setContentText("\u8c03\u63a7\u63aa\u65bd\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        if (StrUtil.isBlank((CharSequence)area)) {
            alert.setContentText("\u5730\u70b9\u4e0d\u53ef\u4e3a\u7a7a");
            alert.showAndWait();
            return;
        }
        if (area.length() > 10) {
            alert.setContentText("\u5730\u70b9\u957f\u5ea6\u6700\u5927\u4e3a10");
            alert.showAndWait();
            return;
        }
        TempHumiInData inData = new TempHumiInData();
        inData.setGsthArea(area);
        inData.setGsthTemp(temp);
        inData.setGsthHumi(humi);
        inData.setGsthCheckStep(checkStep);
        inData.setGsthCheckTemp(checkTemp);
        inData.setGsthCheckHumi(checkHumi);
        HttpJson rsp = TempHumiUtil.addTempHumi(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u4fdd\u5b58\u6210\u529f");
            alert.showAndWait();
            this.closeWindow();
            this.tempHumiController.initTable(0);
            this.tempHumiController.getPagination().setCurrentPageIndex(0);
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    private void closeWindow() {
        this.modelPane.getScene().getWindow().hide();
    }

    public Button getAddBtn() {
        return this.addBtn;
    }

    public Button getCancelBth() {
        return this.cancelBth;
    }

    public Pane getModelPane() {
        return this.modelPane;
    }

    public TextField getGsthBrId() {
        return this.gsthBrId;
    }

    public TextField getGsthBrName() {
        return this.gsthBrName;
    }

    public TextField getGsthTemp() {
        return this.gsthTemp;
    }

    public TextField getGsthHumi() {
        return this.gsthHumi;
    }

    public TextField getGsthCheckTemp() {
        return this.gsthCheckTemp;
    }

    public TextField getGsthCheckHumi() {
        return this.gsthCheckHumi;
    }

    public TextField getGsthCheckStep() {
        return this.gsthCheckStep;
    }

    public TextField getGsthArea() {
        return this.gsthArea;
    }

    public Stage getStg() {
        return this.stg;
    }

    public TempHumiController getTempHumiController() {
        return this.tempHumiController;
    }

    public void setAddBtn(Button addBtn) {
        this.addBtn = addBtn;
    }

    public void setCancelBth(Button cancelBth) {
        this.cancelBth = cancelBth;
    }

    public void setModelPane(Pane modelPane) {
        this.modelPane = modelPane;
    }

    public void setGsthBrId(TextField gsthBrId) {
        this.gsthBrId = gsthBrId;
    }

    public void setGsthBrName(TextField gsthBrName) {
        this.gsthBrName = gsthBrName;
    }

    public void setGsthTemp(TextField gsthTemp) {
        this.gsthTemp = gsthTemp;
    }

    public void setGsthHumi(TextField gsthHumi) {
        this.gsthHumi = gsthHumi;
    }

    public void setGsthCheckTemp(TextField gsthCheckTemp) {
        this.gsthCheckTemp = gsthCheckTemp;
    }

    public void setGsthCheckHumi(TextField gsthCheckHumi) {
        this.gsthCheckHumi = gsthCheckHumi;
    }

    public void setGsthCheckStep(TextField gsthCheckStep) {
        this.gsthCheckStep = gsthCheckStep;
    }

    public void setGsthArea(TextField gsthArea) {
        this.gsthArea = gsthArea;
    }

    public void setStg(Stage stg) {
        this.stg = stg;
    }

    public void setTempHumiController(TempHumiController tempHumiController) {
        this.tempHumiController = tempHumiController;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof AddTempHumiController)) {
            return false;
        }
        AddTempHumiController other = (AddTempHumiController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        Button this$addBtn = this.getAddBtn();
        Button other$addBtn = other.getAddBtn();
        if (this$addBtn == null ? other$addBtn != null : !this$addBtn.equals(other$addBtn)) {
            return false;
        }
        Button this$cancelBth = this.getCancelBth();
        Button other$cancelBth = other.getCancelBth();
        if (this$cancelBth == null ? other$cancelBth != null : !this$cancelBth.equals(other$cancelBth)) {
            return false;
        }
        Pane this$modelPane = this.getModelPane();
        Pane other$modelPane = other.getModelPane();
        if (this$modelPane == null ? other$modelPane != null : !this$modelPane.equals(other$modelPane)) {
            return false;
        }
        TextField this$gsthBrId = this.getGsthBrId();
        TextField other$gsthBrId = other.getGsthBrId();
        if (this$gsthBrId == null ? other$gsthBrId != null : !this$gsthBrId.equals(other$gsthBrId)) {
            return false;
        }
        TextField this$gsthBrName = this.getGsthBrName();
        TextField other$gsthBrName = other.getGsthBrName();
        if (this$gsthBrName == null ? other$gsthBrName != null : !this$gsthBrName.equals(other$gsthBrName)) {
            return false;
        }
        TextField this$gsthTemp = this.getGsthTemp();
        TextField other$gsthTemp = other.getGsthTemp();
        if (this$gsthTemp == null ? other$gsthTemp != null : !this$gsthTemp.equals(other$gsthTemp)) {
            return false;
        }
        TextField this$gsthHumi = this.getGsthHumi();
        TextField other$gsthHumi = other.getGsthHumi();
        if (this$gsthHumi == null ? other$gsthHumi != null : !this$gsthHumi.equals(other$gsthHumi)) {
            return false;
        }
        TextField this$gsthCheckTemp = this.getGsthCheckTemp();
        TextField other$gsthCheckTemp = other.getGsthCheckTemp();
        if (this$gsthCheckTemp == null ? other$gsthCheckTemp != null : !this$gsthCheckTemp.equals(other$gsthCheckTemp)) {
            return false;
        }
        TextField this$gsthCheckHumi = this.getGsthCheckHumi();
        TextField other$gsthCheckHumi = other.getGsthCheckHumi();
        if (this$gsthCheckHumi == null ? other$gsthCheckHumi != null : !this$gsthCheckHumi.equals(other$gsthCheckHumi)) {
            return false;
        }
        TextField this$gsthCheckStep = this.getGsthCheckStep();
        TextField other$gsthCheckStep = other.getGsthCheckStep();
        if (this$gsthCheckStep == null ? other$gsthCheckStep != null : !this$gsthCheckStep.equals(other$gsthCheckStep)) {
            return false;
        }
        TextField this$gsthArea = this.getGsthArea();
        TextField other$gsthArea = other.getGsthArea();
        if (this$gsthArea == null ? other$gsthArea != null : !this$gsthArea.equals(other$gsthArea)) {
            return false;
        }
        Stage this$stg = this.getStg();
        Stage other$stg = other.getStg();
        if (this$stg == null ? other$stg != null : !this$stg.equals(other$stg)) {
            return false;
        }
        TempHumiController this$tempHumiController = this.getTempHumiController();
        TempHumiController other$tempHumiController = other.getTempHumiController();
        return !(this$tempHumiController == null ? other$tempHumiController != null : !(this$tempHumiController).equals(other$tempHumiController));
    }

    protected boolean canEqual(Object other) {
        return other instanceof AddTempHumiController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        Button $addBtn = this.getAddBtn();
        result = result * 59 + ($addBtn == null ? 43 : $addBtn.hashCode());
        Button $cancelBth = this.getCancelBth();
        result = result * 59 + ($cancelBth == null ? 43 : $cancelBth.hashCode());
        Pane $modelPane = this.getModelPane();
        result = result * 59 + ($modelPane == null ? 43 : $modelPane.hashCode());
        TextField $gsthBrId = this.getGsthBrId();
        result = result * 59 + ($gsthBrId == null ? 43 : $gsthBrId.hashCode());
        TextField $gsthBrName = this.getGsthBrName();
        result = result * 59 + ($gsthBrName == null ? 43 : $gsthBrName.hashCode());
        TextField $gsthTemp = this.getGsthTemp();
        result = result * 59 + ($gsthTemp == null ? 43 : $gsthTemp.hashCode());
        TextField $gsthHumi = this.getGsthHumi();
        result = result * 59 + ($gsthHumi == null ? 43 : $gsthHumi.hashCode());
        TextField $gsthCheckTemp = this.getGsthCheckTemp();
        result = result * 59 + ($gsthCheckTemp == null ? 43 : $gsthCheckTemp.hashCode());
        TextField $gsthCheckHumi = this.getGsthCheckHumi();
        result = result * 59 + ($gsthCheckHumi == null ? 43 : $gsthCheckHumi.hashCode());
        TextField $gsthCheckStep = this.getGsthCheckStep();
        result = result * 59 + ($gsthCheckStep == null ? 43 : $gsthCheckStep.hashCode());
        TextField $gsthArea = this.getGsthArea();
        result = result * 59 + ($gsthArea == null ? 43 : $gsthArea.hashCode());
        Stage $stg = this.getStg();
        result = result * 59 + ($stg == null ? 43 : $stg.hashCode());
        TempHumiController $tempHumiController = this.getTempHumiController();
        result = result * 59 + ($tempHumiController == null ? 43 : ($tempHumiController).hashCode());
        return result;
    }

    public String toString() {
        return "AddTempHumiController(addBtn=" + this.getAddBtn() + ", cancelBth=" + this.getCancelBth() + ", modelPane=" + this.getModelPane() + ", gsthBrId=" + this.getGsthBrId() + ", gsthBrName=" + this.getGsthBrName() + ", gsthTemp=" + this.getGsthTemp() + ", gsthHumi=" + this.getGsthHumi() + ", gsthCheckTemp=" + this.getGsthCheckTemp() + ", gsthCheckHumi=" + this.getGsthCheckHumi() + ", gsthCheckStep=" + this.getGsthCheckStep() + ", gsthArea=" + this.getGsthArea() + ", stg=" + this.getStg() + ", tempHumiController=" + this.getTempHumiController() + ")";
    }
}

